<ui:composition 
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"    
    xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface>
        <composite:attribute name="themeFolder" type="java.lang.String"/>
        <composite:attribute name="themeName" type="java.lang.String" required="true"/>
        <composite:attribute name="themeFileName" type="java.lang.String" default="jquery-ui.css"/>
    </composite:interface>

    <composite:implementation>
        <c:set var="themeFolder" value="#{cc.attrs.themeFolder}"/>
        <c:if test="#{empty cc.attrs.themeFolder}">
            <c:set var="themeFolder" value="#{facesContext.externalContext.requestContextPath}#{facesContext.externalContext.requestServletPath}/javax.faces.resource/theme"/>
        </c:if>

        <link type="text/css" rel="stylesheet" id="ds-theme" href="#{themeFolder}/#{cc.attrs.themeName}/#{cc.attrs.themeFileName}" />
        <h:outputScript target="head">
            deltaset.theme().register('ds-theme',
                function(themeName){
                    return '#{themeFolder}/'+themeName+'/#{cc.attrs.themeFileName}';
            });
        </h:outputScript>
    </composite:implementation>
</ui:composition>